Package net.mitza.rel.base

Source Code of net.mitza.rel.base.ExpressionEvaluator

package net.mitza.rel.base;

import net.mitza.rel.parser.Parser;
import net.mitza.rel.parser.expression.ExpressionNode;

import com.tridion.tcdl.TransformContext;

/**
* @author Mihai Cadariu
*/
public class ExpressionEvaluator {

  private final TransformContext context;

  public ExpressionEvaluator(TransformContext context) {
    this.context = context;
  }

  public Object evaluate(String expression) {
    if (expression == null) {
      return "";
    }

    Parser parser = new Parser(context);
    ExpressionNode expressionNode = parser.parseExpression(expression);
    return expressionNode.getValue();
  }
}
TOP

Related Classes of net.mitza.rel.base.ExpressionEvaluator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.